package java111;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;
import test.Read;

public class Day17 {
    // https://www.nowcoder.com/practice/fcd30aac9c4f4028b23919a0c649824d?tpId=290&tqId=39833&ru=/exam/oj
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();

    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int tmp = a;
            StringBuilder sb = new StringBuilder();
            while(tmp != 0){
                int cur = tmp % 10;
                if(cur % 2 == 0){
                    cur = 0;
                } else {
                    cur = 1;
                }
                sb.append(cur);
                tmp /= 10;
            }
            sb.reverse();
            while(sb.length() != 1 && sb.charAt(0) == '0'){
                sb.deleteCharAt(0);
            }
            System.out.println(sb);
        }
    }

    //https://ac.nowcoder.com/acm/contest/5600/I
    // 十字爆破 超时
    public static void main2(String[] args) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        long[][] arr = new long[n][m];
        long[] r = new long[n];
        long[] c = new long[m];
        for(int i = 0; i < arr.length; i++){
            for(int j = 0; j < arr[i].length; j++){
                arr[i][j] = in.nextInt();
                r[i] += arr[i][j];
                c[j] += arr[i][j];
            }
        }
        long[][] res = new long[n][m];
        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                res[i][j] = r[i] + c[j] - arr[i][j];
                out.print(res[i][j] + " ");
            }
            out.println();
        }
        out.close();
    }


    //https://ac.nowcoder.com/acm/problem/224679
    public static void main3(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        long[] arr1 = new long[n];
        long[] arr2 = new long[n];
        for(int i = 0; i < n; i++){
            arr1[i] = in.nextInt();
        }
        for(int j = 0; j < n; j++){
            arr2[j] = in.nextInt();
        }
        long sum1 = 0, sum2 = 0, res = -1, max = 0, min = Integer.MAX_VALUE;
        for(int left = 0, right = 0; right < n; right++){
            sum1 += arr1[right];
            sum2 += arr2[right];
            if(right - left + 1 == k){
                if(sum1 > max){
                    max = sum1;
                    res = left;
                    min = sum2;
                } else if(sum1 == max){
                    if(sum2 < min){
                        min = sum2;
                        res = left;
                    }
                }
                sum1 -= arr1[left];
                sum2 -= arr2[left++];
            }
        }
        System.out.println(res + 1);
    }
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        long[] arr1 = new long[n];
        long[] arr2 = new long[n];
        for(int i = 0; i < n; i++){
            arr1[i] = in.nextInt();
        }
        for(int j = 0; j < n; j++){
            arr2[j] = in.nextInt();
        }
        long[] dp1 = new long[n+1], dp2 = new long[n+1];
        dp1[1] = arr1[0];
        dp2[1] = arr2[0];
        for(int i = 2; i <= n; i++){
            dp1[i] = dp1[i-1] + arr1[i-1];
            dp2[i] = dp2[i-1] + arr2[i-1];
        }
        long max = 0, min = Integer.MAX_VALUE, res = -1;
        for(int left = 0, right = 0; right <= n; right++){
            if(right - left == k){
                if(dp1[right] - dp1[left] > max){
                    max = dp1[right] - dp1[left];
                    res = left;
                    min = dp2[right] - dp2[left];
                } else if(dp1[right] - dp1[left] == max){
                    if(dp2[right] - dp2[left] < min){
                        min = dp2[right] - dp2[left];
                        res = left;
                    }
                }
                left++;
            }
        }
        System.out.println(res+1);
    }
}

